Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rtext] Centralize Text #4623

Closed

Conversation

nircoe
Copy link

@nircoe nircoe commented Dec 20, 2024

Added two methods into rtext.c (and the methods declarations into raylib.h) -

  1. CentralizeText (for default font)
  2. CentralizeTextEx (for specific font)

Used the same logic as in "MeasureText" and "MeasureTextEx" methods:
In the "CentralizeText" method - check if the default font has been loaded,
If it doesn't - return the zero vector.
If it does - modify the fontSize, calculate the spacing, and then call the "CentralizeTextEx" method to calculate the desired textPosition.

Added two methods into rtext.c -
CentralizeText (for default font),
CentralizeTextEx (for specific font).
Used the same logic as in "MeasureText" method:
In "CentralizeText" method check if the default font has been loaded, if it doesn't - return the zero vector.
if it does - modify the fontSize, calculate the spacing, and then call to "CentralizeTextEx" method that will calculate the desired textPosition.
Added the methods declarations into raylib.h
@nircoe nircoe changed the title Centralize Text [rtext] Centralize Text Dec 20, 2024
@raysan5
Copy link
Owner

raysan5 commented Dec 23, 2024

@nircoe I'm afraid I try to minimize new functions additions unless they are really needed, those functions can be implemented on user size if required.

@raysan5 raysan5 closed this Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants